﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XWord.WPF.ApplicationFramework.Validations
{
    public class StringLengthValidator : Validator
    {
        public int MaximumLength { get; set; }

        public int MinimumLength { get; set; }

        public override bool Validate()
        {
            ErrorMessage = string.Format("字符長度必須介於{0}和{1}之間", MinimumLength, MaximumLength);
            int num = (Property == null) ? 0 : ((string)Property).Length;
            return ((Property == null) || ((num >= this.MinimumLength) && (num <= this.MaximumLength)));
        }

        
    }
}
